﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace EStore.Core.Orders
{
    /// <summary>
    /// 中国大陆收获人信息
    /// </summary>
    public class ShippingAddressChina : ShippingAddress
    {
        public ShippingAddressChina(string name, string area, string street, string postcode, string tel)
        {
            Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(name), "联系人不能为空");
            Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(area), "区域地址不能为空");
            Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(street), "街道地址不能为空");

            //TODO 解决拓展方法可视级别不够的问题

            //Contract.Requires<ArgumentException>(postcode.IsPostCode(ValueObjects.AdministrativeArea.China), "邮政编码错误");
            //Contract.Requires<ArgumentException>(tel.IsTel(), "联系电话错误");

            this.Name = name;
            this.AreaAddress = area;
            this.StreetAddress = street;
            this.PostCode = postcode;
            this.Tel = tel;
        }

        /// <summary>
        /// 联系人
        /// </summary>
        public string Name { get; private set; }

        /// <summary>
        /// 区域地址
        /// </summary>
        public string AreaAddress { get; private set; }

        /// <summary>
        /// 街道地址
        /// </summary>
        public string StreetAddress { get; private set; }

        /// <summary>
        /// 邮政编码
        /// </summary>
        public string PostCode { get; private set; }

        /// <summary>
        /// 电话号码
        /// </summary>
        public string Tel { get; private set; }


        public string FullAddress
        {
            get
            {
                return this.AreaAddress + this.StreetAddress;
            }
        }
    }
}
